import request from '@/utils/request'
// 列表
export function GetListAPI(params) {
  return request({
    url: '/order/sales-order/list',
    method: 'GET',
    params
  })
}

// 新增
export function AddDataAPI(data) {
  return request({
    url: '/order/sales-order/add',
    method: 'POST',
    data
  })
}

// 修改
export function EditDataAPI(data) {
  return request({
    url: '/order/sales-order/update',
    method: 'POST',
    data
  })
}

// 删除
export function DelDataAPI(data) {
  return request({
    url: '/order/sales-order/delete/' + data,
    method: 'DELETE'
  })
}

// 查看详情
export function GetDetailAPI(data) {
  return request({
    url: '/order/sales-order/view/' + data,
    method: 'GET'
  })
}
// 提交审核
export function SubmitReviewAPI(data) {
  return request({
    url: '/order/sales-order/submitReview/' + data,
    method: 'GET'
  })
}

// 撤销审核
export function DeleteReviewAPI(data) {
  return request({
    url: '/order/sales-order/deleteReview/' + data,
    method: 'GET'
  })
}

// 订单评审
export function ReviewSubmitAPI(data) {
  return request({
    url: '/order/sales-order/submitReview/' + data,
    method: 'GET'
  })
}

// 手动关结
export function SalesOrderAPI(data) {
  return request({
    url: '/order/sales-order/close',
    method: 'POST',
    data
  })
}

// 合同上传
export function ContractUploadAPI(data) {
  return request({
    url: '/order/sales-order/contractUpload',
    method: 'POST',
    data
  })
}

// 销售订单明细列表
export function GetContractListAPI(params) {
  return request({
    url: '/order/sales-order-detail/list/' + params.id,
    method: 'GET',
    params
  })
}

// 销售订单明细修改
export function OrderUpdateAPI(data) {
  return request({
    url: '/order/sales-order-detail/update',
    method: 'POST',
    data
  })
}

// 销售订单明细查看
export function OrderDetailAPI(params) {
  return request({
    url: '/order/sales-order-detail/view/' + params,
    method: 'GET'
  })
}

// 审核
export function ToExamineAPI(data) {
  return request({
    url: '/order/sales-order/saleOrderReview',
    method: 'POST',
    data
  })
}

// 生成发货单
export function GenerateInvoiceAPI(data) {
  return request({
    url: '/order/sales-order-detail/generateInvoice',
    method: 'POST',
    data
  })
}

/**
 * 原料校验预览
 */

export function getRawSaleDetailAPI(data) {
  return request({
    url: '/order/sales-order/rawSaleDetail/' + data,
    method: 'GET'
  })
}

/**
 * 原料校验开始运算
 */

export function GetRawChecktAPI(data) {
  return request({
    url: '/order/sales-order/rawCheck',
    method: 'PUT',
    data
  })
}

/**
 * 原料保存
 * @param {*} data
 * @returns
 */
export function GenerateInvoiceSubmitAPI(data) {
  return request({
    url: '/order/sales-order/saveRawCheck',
    method: 'POST',
    data
  })
}

/**
 * 金蝶云拉取销售订单
 * @param {*} data
 * @returns
 */
export function getJinDieSaleAPI(data) {
  return request({
    url: '/order/sales-order/getJinDieSale',
    method: 'PUT',
    data
  })
}
